package com.weixin.gong.example.jdk.bean;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Created at 2017/11/6 19:39
 *
 * @author gongweixin
 */
public class NaNExample {
    @Test
    public void NaNToDouble() {
        double a = Double.NaN;
        assertEquals(Double.NaN, Double.NaN + Double.NaN, 0D);
        assertEquals(Double.NaN, Double.NaN + 1D, 0D);
        assertEquals(Double.NaN, Double.NaN - Double.NaN, 0D);
        assertEquals(Double.NaN, Double.NaN - 1D, 0D);
        assertEquals(Double.NaN, Double.NaN * Double.NaN, 0D);
        assertEquals(Double.NaN, Double.NaN * 1D, 0D);
        assertEquals(Double.NaN, 1D * Double.NaN, 0D);
        assertEquals(Double.NaN, Double.NaN / Double.NaN, 0D);
        assertEquals(Double.NaN, Double.NaN / 1D, 0D);
        assertEquals(Double.NaN, 1D / Double.NaN, 0D);

        assertEquals(Double.NaN, Math.abs(Double.NaN), 0D);
        assertEquals(Double.NaN, Math.sqrt(Double.NaN), 0D);
    }

}
